package com.chenfeng.common.util;
import java.util.Random;
import org.springframework.stereotype.Component;
import com.sun.org.apache.regexp.internal.recompile;
@Component("regexUtil")
public class RegexUtil
{  
	public String randStr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
	//创建一个随机数 随机数的长度由传入的参数决定
	public String randString(int length)
	{
		StringBuffer sb = new StringBuffer();
		Random rand = new Random();
		for(int i = 0 ; i < length ; i ++ )
		{
			int randCh = rand.nextInt(this.randStr.length());
			sb.append(this.randStr.charAt(randCh));
		}
		return sb.toString();
	}
}
